package com.ruowei.modules.foodOrder.repository;

import com.ruowei.common.repository.BaseRepository;
import com.ruowei.modules.foodOrder.domain.Merchandise;

import com.ruowei.modules.foodOrder.domain.QMerchandise;
import org.springframework.data.jpa.repository.*;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

/**
 * Spring Data  repository for the Merchandise entity.
 */
@Repository
public interface MerchandiseRepository extends BaseRepository<Long, Merchandise, QMerchandise> {

    Boolean existsByMerchantCodeAndTypeCodeAndMerchandiseNameAndDeleteStatus(String merchantCode, String typeCode, String merchandiseName, Boolean deleteStatus);

    Optional<Merchandise> findOneByMerchandiseCodeAndDeleteStatus(String merchandiseCode, Boolean deleteStatus);

    Optional<Merchandise> findFirstByMerchandiseCodeAndDeleteStatusAndPublishStatus(String merchandiseCode, Boolean deleteStatus, Boolean publishStatus);

    Optional<Merchandise> findFirstByMerchandiseCode(String merchandiseCode);

    Boolean existsByMerchantCodeAndDeleteStatus(String merchantCode, Boolean deleteStatus);

    List<Merchandise> findAllByTypeCode(String typeCode);

    List<Merchandise> findAllByMerchantCodeAndDeleteStatus(String merchantCode, boolean b);

    List<Merchandise> findAllByTypeCodeAndDeleteStatus(String typeCode, Boolean deleteStatus);
}
